const devConfig = require('./dev')
const prodConfig = require('./prod')
const isProduct = ['production', 'prod'].includes(process.env.NODE_ENV)
const config = isProduct ? prodConfig : devConfig
module.exports = {
  styleOutputPath: 'style',
  outputPath: 'dist/packages',
  clearConsole: config.clearConsole,
  css: {
    extract: false, 
  },
  // 打包忽略
  externalMap: [
    {
      'vue': 'vue',
      'vue-router': 'vue-router',
      'vuex': 'vuex',
      'system': 'system',
      'axios': 'axios',
      'iview': 'iview',
      'moment': 'moment',
      'echarts': 'echarts',
      'element-ui': 'element-ui'
    },
    /^@daelui\//,
    /element-ui/,
    function(context, request, callback) {
      if (/vendor\/monaco-editor$|vendor\/(vue-)?quill|vendor\/highlightjs/.test(request)) {
        return callback(null, request.replace(/.*vendor\//, ''))
      }
      callback()
    }
  ]
}
